//
//  DWTabViewContent.swift
//  DWSwift
//
//  Created by GDL on 2025/6/20.
//

//


import SwiftUI

struct DWTabViewContent<DWcontent:View>: View {
    var tab: DWTabItem
    @Binding var selectedTab: Int
    @Binding var tabs: [DWTabItem]
    
    @ViewBuilder let content: (Int) -> DWcontent// 内容生成器
    
    
    var body: some View {
       
//        VStack(spacing:0){
////            content(selectedTab).frame(maxWidth: .infinity, maxHeight: .infinity)
////                .background(Color(UIColor.yellow))
////                .tabItem {
////                    DWTabItemView(tab: tab, selectedTab: $selectedTab, tabs: $tabs)
////                }
////                .animation(.spring(), value: selectedTab)
//            // 自定义 TabBar
//          
//        }
        content(selectedTab)
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .background(Color(UIColor.clear))
            .tabItem {
                DWTabItemView(tab: tab, selectedTab: $selectedTab, tabs: $tabs)
            }
            .animation(.spring(), value: selectedTab)
        
        
//        Text("\(tab.name) View")
//            .font(.title2)
//            .foregroundColor(.primary)
//            .frame(maxWidth: .infinity, maxHeight: .infinity)
//            .background(Color(UIColor.yellow))
//            .tabItem {
//                DWTabItemView(tab: tab, selectedTab: $selectedTab, tabs: $tabs)
//            }
//            .animation(.spring(), value: selectedTab)
        

    }
}
